home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / svgabg31.zip / INITSVGA.PAS < prev    next >
Pascal/Delphi Source File  |  1991-12-06  |  3KB  |  149 lines

  1. { Sample program that initializes the SuperVGA driver}
  2. Program Test256;
  3.  
  4. Uses Graph,Crt,Dos;
  5.  
  6. {$i svga16.inc}
  7. {$i svga256.inc}
  8. {$i svga32k.inc}
  9.  
  10. (* Uncomment this if you link in the drivers *)
  11. (*
  12. procedure Svga16_driver; external;
  13. { $L svga16.obj }
  14.  
  15. procedure Svga256_driver; external;
  16. { $L svga256.obj }
  17.  
  18. procedure Twk256_driver; external;
  19. { $L twk256.obj }
  20.  
  21. procedure Twk16_driver; external;
  22. { $L twk16.obj }
  23.  
  24. procedure Svga32k_driver; external;
  25. { $L svga32k.obj }
  26. *)
  27.  
  28. var
  29.   GraphMode, GraphDriver : integer;
  30.   Ky : Char;
  31.   Drv : Integer;
  32.  
  33. function WhitePixel : Word;
  34. begin
  35.   if (GetMaxColor > 256) then
  36.     WhitePixel := 32767
  37.   else
  38.     WhitePixel := 15;
  39. end;
  40.  
  41. {$F+}
  42. function DetectVGA256 : Integer;
  43. var Vid : Integer;
  44.  
  45. begin
  46.   Writeln('Which video mode would you like to use?');
  47.   Writeln('  0) 320x200x256');
  48.   Writeln('  1) 640x400x256');
  49.   Writeln('  2) 640x480x256');
  50.   Writeln('  3) 800x600x256');
  51.   Writeln('  4) 1024x768x256');
  52.   Write('> ');
  53.   Readln(Vid);
  54.   DetectVGA256 := Vid;
  55. end;
  56.  
  57. function DetectVGA32k : Integer;
  58. var Vid : Integer;
  59.  
  60. begin
  61.   Writeln('Which video mode would you like to use?');
  62.   Writeln('  0) 320x200x32768');
  63.   Writeln('  1) 640x350x32768');
  64.   Writeln('  2) 640x400x32768');
  65.   Writeln('  3) 640x480x32768');
  66.   Writeln('  4) 800x600x32768');
  67.   Write('> ');
  68.   Readln(Vid);
  69.   DetectVGA32k := Vid;
  70. end;
  71.  
  72.  
  73. function DetectVGA16 : Integer;
  74. var Vid : Integer;
  75.  
  76. begin
  77.   Writeln('Which video mode would you like to use? ');
  78.   Writeln('  0) 320x200x16');
  79.   Writeln('  1) 640x200x16');
  80.   Writeln('  2) 640x350x16');
  81.   Writeln('  3) 640x480x256');
  82.   Writeln('  4) 800x600x16');
  83.   Writeln('  5) 1024x768x16');
  84.   Writeln('>');
  85.   Readln(Vid);
  86.   DetectVGA16 := Vid;
  87. end;
  88.  
  89. function DetectTwk256 : Integer;
  90. var Vid : Integer;
  91.  
  92. begin
  93.   Writeln('Which video mode would you like to use?');
  94.   Writeln('  0) 320x400x256');
  95.   Writeln('  1) 320x480x256');
  96.   Writeln('  2) 360x480x256');
  97.   Writeln('  3) 376x564x256');
  98.   Writeln('  4) 400x564x256');
  99.   Writeln('  5) 400x600x256');
  100.   Write('> ');
  101.   Readln(Vid);
  102.   DetectTwk256 := Vid;
  103. end;
  104.  
  105. function DetectTwk16 : Integer;
  106. var Vid : Integer;
  107.  
  108. begin
  109.   Writeln('Which video mode would you like to use? ');
  110.   Writeln('  0) 704x528x16');
  111.   Writeln('  1) 720x540x16');
  112.   Writeln('  2) 736x552x16');
  113.   Writeln('  3) 752x564x256');
  114.   Writeln('  4) 768x576x16');
  115.   Writeln('  5) 784x588x16');
  116.   Writeln('  6) 800x600x16');
  117.   Writeln('>');
  118.   Readln(Vid);
  119.   DetectTwk16 := Vid;
  120. end;
  121. {$F-}
  122.  
  123. begin
  124.   Writeln('Which driver would you like to use?');
  125.   Writeln('  0) Svga256');
  126.   Writeln('  1) Svga16');
  127.   Writeln('  2) Tweak256');
  128.   Writeln('  3) Tweak16');
  129.   Writeln('  4) Svga32k');
  130.   Write('>');
  131.   Readln(Drv);
  132.   if (Drv = 0) then
  133.     GraphDriver := InstallUserDriver('SVGA256',@DetectVGA256)
  134.   else if (Drv = 1) then
  135.     GraphDriver := InstallUserDriver('SVGA16',@DetectVGA16)
  136.   else if (Drv = 2) then
  137.     GraphDriver := InstallUserDriver('Twk256',@DetectTwk256)
  138.   else if (Drv = 3) then
  139.     GraphDriver := InstallUserDriver('Twk16',@DetectTwk16)
  140.   else if (Drv = 4) then
  141.     GraphDriver := InstallUserDriver('Svga32k',@DetectVGA32k);
  142.   GraphDriver := Detect;
  143.   InitGraph(GraphDriver,GraphMode,'');
  144.   setcolor(RealDrawColor(WhitePixel));
  145.   line(0,0,GetMaxX,GetMaxY);
  146.   line(0,GetMaxY,GetMaxX,0);
  147.   Ky := ReadKey;
  148.   CloseGraph;
  149. end.